package com.fxc;

import java.applet.Applet;
import java.applet.AudioClip;
import java.io.File;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;

import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.SourceDataLine;

public class Audio extends Thread{
	
	
    private AudioClip aau;
    private String url = "src/source/img/start.wav";

	@Override
	public void run() {
		playMusic();
	}

    public  void playMusic(){
        try {
            URL cb;
            //可以在项目里创建一个Source folder包，将音乐文件放到这个包里,再把路径给它
            File f = new File(url); 
            cb = f.toURL();
            
            aau = Applet.newAudioClip(cb);
            aau.loop();
        } catch (MalformedURLException e) {
            
            e.printStackTrace();
        }
    }
    
    
    public void close() {
    	Thread.currentThread();
    }
	
}
